from models import Servertype
from tools import *

def test_output():
    output = Output()
    output.purchase_server(Servertype('NV603', 1, 1, 1, 1))
    output.purchase_server(Servertype('NV603', 1, 1, 1, 1))
    output.purchase_server(Servertype('NV602', 1, 1, 1, 1), amount=2)
    output.migrate('vm234', 23)
    output.migrate('vm244', 23)
    output.allocate(2)
    output.allocate_single_node(3, 'a')

    output.start_a_new_day()
    output.purchase_server(Servertype('NV604', 1, 1, 1, 1))
    output.purchase_server(Servertype('NV605', 1, 1, 1, 1))
    output.purchase_server(Servertype('NV602', 1, 1, 1, 1), amount=2)
    output.migrate('vm23245', 23)
    output.migrate('vm24984', 23)
    output.allocate(6)
    output.allocate_single_node(3, 'b')
    output.output()

def test_parser():
    parser = Parser()
    servertype = parser.parse_server('(hostW1Q5U, 800, 102, 179861, 224)')
    vmtype = parser.parse_vm('(vm313FP, 114, 37, 0)')
    op = parser.parse_operation('(add, vm3ZSG9, 984038566)')
    op2 = parser.parse_operation('(del, 268877089)')
    print(servertype)
    print(vmtype)
    print(op)
    print(op2)

if __name__ == '__main__':
    #test_output()
    b = B()
    b.f()
